﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Mechanical;

namespace YArchitech.HCLoad.Export
{
	public class HcSurfaceData
	{
		public string Id
		{
			get
			{
				return this.m_sId;
			}
		}

		public string ConstructionId
		{
			get
			{
				return this.m_sConstructionId;
			}
			set
			{
				this.m_sConstructionId = value;
			}
		}

		public Face Face
		{
			get
			{
				return this.m_face;
			}
		}

		public Space Space
		{
			get
			{
				return this.m_space;
			}
		}

		public string Name
		{
			get
			{
				return this.m_sName;
			}
		}

		public bool Exterior
		{
			get
			{
				return this.m_bExterior;
			}
			set
			{
				this.m_bExterior = value;
			}
		}

		public List<ElementId> AdjacentSpaceIds
		{
			get
			{
				return this.m_adjacentSpaceIds;
			}
		}

		public List<string> AdjacentHcSurfaceIds
		{
			get
			{
				return this.m_adjacentHcSurfaceIds;
			}
		}

		public Element Host
		{
			get
			{
				return this.m_host;
			}
		}

		public HcSurfaceData(PlanarFace face, Space space)
		{
			this.m_sId = this.PopulateId();
			this.m_face = face;
			this.m_bExterior = true;
			this.m_space = space;
		}

		public bool AddAdjacentSpaceIdRef(ElementId spaceId)
		{
			if (this.m_adjacentSpaceIds == null)
			{
				this.m_adjacentSpaceIds = new List<ElementId>();
			}
			this.m_adjacentSpaceIds.Add(spaceId);
			return true;
		}

		public bool AddAdjacentHcSurfaceIds(string shcSurfaceId)
		{
			if (this.m_adjacentHcSurfaceIds == null)
			{
				this.m_adjacentHcSurfaceIds = new List<string>();
			}
			this.m_adjacentHcSurfaceIds.Add(shcSurfaceId);
			return true;
		}

		public bool ObtainHost()
		{
			this.m_host = null;
			return false;
		}

		private string PopulateId()
		{
			HcSurfaceData.nConstructorIndex++;
			return "su-" + HcSurfaceData.nConstructorIndex.ToString();
		}

		private static int nConstructorIndex;

		private string m_sId = string.Empty;

		private string m_sConstructionId;

		private Space m_space;

		private PlanarFace m_face;

		private Element m_host;

		private List<ElementId> m_adjacentSpaceIds;

		private List<string> m_adjacentHcSurfaceIds;

		private bool m_bExterior;

		private string m_sName;
	}
}
